; Music of Mobile Man (1990) (Loriciels) (JP Biscay)
; Ripped by Megachur the 10/01/2009

	write "MOBILEMA.BIN"

music_date_rip	equ &0a19
music_adr	equ &7b91
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

.l7b91
	db #04,#03,#f8,#0a,#01,#e0,#14,#01
.l7b9e equ $ + 5
	db #5c,#0a,#01,#a4,#14,#03,#10,#80
.l7ba8 equ $ + 7
	db #01,#5d,#ee,#01,#35,#ef,#08,#01
.l7bac equ $ + 3
	db #0c,#08,#01,#04,#14,#04,#01,#28
	db #06,#01,#14,#14,#01,#3c,#ff,#01
.l7bbd equ $ + 4
.l7bb9
	db #01,#1e,#06,#02,#01,#06,#1f,#01
.l7bc1
	db #03,#1f,#04,#01,#1a,#01,#02,#1e
.l7bcb equ $ + 2
	db #f8,#01,#02,#02,#01,#02,#01,#02
.l7bd6 equ $ + 5
.l7bd2 equ $ + 1
	db #01,#01,#0a,#ff,#14,#02,#01,#01
.l7bdd equ $ + 4
	db #02,#07,#fe,#06,#02,#02,#07,#02
.l7be4 equ $ + 3
	db #06,#fa,#01,#02,#01,#02,#01,#0f
.l7beb equ $ + 2
	db #ff,#0f,#02,#01,#0d,#01,#0d,#ff
.l7bf2 equ $ + 1
	db #08,#02,#01,#0f,#01,#0d,#ff,#02
.l7c00 equ $ + 7
.l7bf9
	db #02,#01,#0e,#02,#02,#f9,#02,#02
.l7c07 equ $ + 6
	db #01,#0b,#08,#06,#fe,#04,#02,#01
	db #0a,#0a,#04,#fe,#02
.l7c0e
	dw l7b91,l7b9e,l7ba8,l7bac
	dw l7bb9,l7bbd,l7bc1,l7b91
	dw l7b91,l7b91,l7bcb,#ffff
.l7c26
	dw l7bd2,l7bd6,l7bdd,l7be4
	dw l7beb,l7bd2,l7bd2,l7bd2
	dw l7bd2,l7bd2,l7bf2,l7bf9
	dw l7c00,l7c07,#ffff
;
.init_env
;
	ld ix,l7c0e
	ld b,#01
.l7c4a
	ld h,(ix+#01)
	ld l,(ix+#00)
	ld a,h
	cp #ff
	jp z,l7c63
	push bc
	ld a,b
	call #bcbf
	pop bc
	inc b
	inc ix
	inc ix
	jr l7c4a
.l7c63
	ld ix,l7c26
	ld b,#01
.l7c69
	ld h,(ix+#01)
	ld l,(ix+#00)
	ld a,h
	cp #ff
	jp z,l7c82
	push bc
	ld a,b
	call #bcbc
	pop bc
	inc b
	inc ix
	inc ix
	jr l7c69
.l7c82
	ret
	
;#8600
.l8600
	dw #0eee,#0e18,#0d4d,#0c8e
	dw #0bda,#0b2f,#0a8f,#09f7
	dw #0968,#08e1,#0861,#07e9
	dw #0777,#070c,#06a7,#0647
	dw #05ed,#0598,#0547,#04fc
	dw #04b4,#0470,#0431,#03f4
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #001e,#001c,#001b,#0019
	dw #0018,#0016,#0015,#0014
	dw #0013,#0012,#0011,#0010
.l86c0
	jp l8869
	jp l8876
.l86c6
	db #01,#01,#00
	dw l88ec,l88ec,l88ec,#0000
.l86d1
	db #01,#01,#00
	dw l88e9,l890f,l890f,l8918
	dw l8918,l890f,l890f,l8918
	dw l8918,l890f,l890f,l8918
	dw l8918,l8921,l8921,l892a
	dw l892a,#0000
.l86f8
	db #01,#01,#00
	dw l88e9,l88e9,l88e9,l88e9
	dw l88e9,l8967,l8967,l8974
	dw l8974,l8967,l8967,l8974
	dw l8974,l8981,l8981,l898e
	dw l898e,l88e9,l899f,l899f
	dw l89aa,l89aa,l899f,l899f
	dw l89aa,l89aa,l899f,l899f
	dw l89aa,l89aa,l89b7,l89b7
	dw l89c2,l89c2,l88e9,l899f
	dw l899f,l89aa,l89aa,l899f
	dw l899f,l89aa,l89aa,l899f
	dw l899f,l89aa,l89aa,l89b7
	dw l89b7,l89c2,l89c2
.l8768 equ $ + 7
.l8767 equ $ + 6
.l8766 equ $ + 5
.l8765 equ $ + 4
.l8763 equ $ + 2
	db #00,#00,#00,#00,#00,#00,#01,#0b
.l8770 equ $ + 7
.l876e equ $ + 5
.l876c equ $ + 3
.l876a equ $ + 1
.l8769
	db #0b,#00,#00,#00,#00,#00,#00,#02
	db #0d,#0d,#00,#00,#00,#02,#00,#00
.l8779
	db #04,#0e,#0e,#00,#00,#00,#00,#00
	db #00
.l8782
	ld iy,l86d1
	ld a,#02
.l8788
	ld (l8766),a
	dec (iy+#00)
	ret nz
.l878f
	push iy
	pop hl
	inc hl
	ld a,(iy+#01)
	add a
	ld c,a
	ld b,#00
	add hl,bc
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld a,d
	or a
	jr nz,l87ac
	ld (iy+#01),#01
.l87a6
	ld (iy+#02),#00
	jr l878f
.l87ac
	ex de,hl
	ld c,(iy+#02)
	ld b,#00
	add hl,bc
	push hl
	pop ix
	ld a,(ix+#00)
.l87ba equ $ + 1
	call l881c
	ld a,(ix+#01)
	ld (iy+#00),a
	ld b,a
	add b
	ld (l8765),a
	ld a,(ix+#00)
	or a
	jr nz,l87d2
.l87cd
	inc (iy+#01)
	jr l87a6
.l87d2
	ld a,(l8766)
	cp #01
	jr nz,l87de
	ld hl,l8767
	jr l87ea
.l87de
	cp #02
	jr nz,l87e7
	ld hl,l8770
	jr l87ea
.l87e7
	ld hl,l8779
.l87ea
	nop
	push hl
	inc hl
	inc hl
	inc hl
	ld de,(l8763)
	ld (hl),e
	inc hl
	ld (hl),d
	inc hl
	inc hl
	inc hl
	ld a,(l8765)
	ld (hl),a
	pop hl
.l87fe
	push ix
	push iy
	call #bcaa
	pop iy
	pop ix
	inc (iy+#02)
	inc (iy+#02)
	ld a,(ix+#02)
	or a
	ret nz
	inc (iy+#01)
	ld (iy+#02),#00
	ret
.l881c
	ld hl,l8600
	add a
	ld c,a
	ld b,#00
	add hl,bc
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld (l8763),de
	ret
.l882c
	ld (l876c),a
	ld a,(ix+#0c)
	ld (l876a),a
	ld a,(ix+#0d)
	ld (l8768),a
	ld a,(ix+#18)
	ld (l8769),a
	ld a,(ix+#01)
	ld (iy+#00),a
	ld (l876e),a
	ld a,(ix+#00)
	or a
	jr z,l8857
	ld hl,l8767
	pop af
	jp l87fe
.l8857
	pop af
	jp l87cd
.l885b
	db #00,#00,#f1,#00,#00,#81
	dw l88cd
	db #00,#00,#00,#00,#00,#00
.l8869
	ld hl,l885b
	ld b,#81
	ld c,#00
	ld de,l88cd
	jp #bce0
.l8876
	ld hl,l885b
	call #bce6
	ld iy,l86d1
	ld (iy+#00),#01
	ld (iy+#01),#01
	ld (iy+#02),#00
	ld iy,l86f8
	ld (iy+#00),#01
	ld (iy+#01),#01
	ld (iy+#02),#00
	ld iy,l86c6
	ld (iy+#00),#01
	ld (iy+#01),#01
	ld (iy+#02),#00
	ret
.l88ad
	ld hl,l882c
	ld (l87ba),hl
	ld a,#01
	ld iy,l86c6
	call l8788
	ld hl,l881c
	ld (l87ba),hl
	ret
.l88c3
	ld a,#04
	ld iy,l86f8
	jp l8788
.l88cc
	db #01
;
.play_music
.l88cd
;
	ld hl,l88cc
	dec (hl)
	ret nz
	ld a,(l88e8)
	ld (hl),a
	push ix
	push iy
	call l8782
	call l88c3
	call l88ad
	pop iy
	pop ix
	ret
.l88ec equ $ + 4
.l88e9 equ $ + 1
.l88e8
	db #06,#15,#28,#00,#14,#0a,#01,#0a
	db #03,#0a,#01,#05,#01,#05,#00,#00
	db #05,#0b,#c8,#0c,#05,#0b,#14,#0c
	db #14,#0c,#00,#00,#0b,#00,#00,#00
	db #0b,#00,#0b,#00,#0b,#00,#00
.l890f
	db #21,#0a,#30,#0a,#2d,#0a,#39,#0a
.l8918 equ $ + 1
	db #00,#1d,#0a,#2d,#0a,#29,#0a,#35
.l8921 equ $ + 2
	db #0a,#00,#24,#0a,#34,#0a,#30,#0a
.l892a equ $ + 3
	db #3c,#0a,#00,#1f,#0a,#2f,#0a,#2b
	db #0a,#37,#0a,#00,#51,#05,#54,#0f
	db #54,#05,#53,#05,#51,#05,#4c,#05
	db #00,#4d,#0a,#48,#05,#4d,#05,#48
	db #05,#4d,#0a,#54,#05,#00,#54,#05
	db #58,#0f,#58,#05,#56,#05,#54,#05
	db #51,#05,#00,#56,#05,#5b,#0f,#4f
	db #05,#58,#05,#56,#05,#54,#05,#00
.l8967
	db #45,#05,#48,#0f,#48,#05,#47,#05
.l8974 equ $ + 5
	db #45,#05,#40,#05,#00,#41,#0a,#3c
	db #05,#41,#05,#3c,#05,#41,#0a,#48
.l8981 equ $ + 2
	db #05,#00,#3c,#05,#40,#0f,#40,#05
.l898e equ $ + 7
	db #3e,#05,#3c,#05,#45,#05,#00,#43
	db #05,#47,#05,#43,#05,#4a,#05,#43
	db #05,#4d,#05,#43,#05,#4f,#05,#00
.l899f
	db #45,#14,#51,#05,#4c,#05,#48,#05
.l89aa equ $ + 3
	db #4c,#05,#00,#4d,#0a,#45,#0a,#48
	db #05,#45,#05,#41,#05,#45,#05,#00
.l89b7
	db #48,#14,#54,#05,#4f,#05,#4c,#05
.l89c2 equ $ + 3
	db #4f,#05,#00,#4f,#0a,#53,#0a,#4f
	db #0a,#53,#0a,#00,#00
;
.init_music	; added by Megachur
;
	call init_env
	jp l86c0
;
.game_name
	db "Mobile Man",0
.game_year
	db "1990",0
.game_publisher
	db "Loriciels",0
.music_author
	db "JP Biscay",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
